 
import { HFSMFactoryHelper } from "../HFSMFactoryHelper";
 
import { TeamUpgradeState } from "../../Control/State/team/TeamUpgradeState";
import { DecisionActive } from "../../Control/Decision/normal/DecisionActive";
import { FactoryGetResource } from "../../Control/State/room/core/factory/FactoryGetResource";
import { FactoryProducing } from "../../Control/State/room/core/factory/FactoryProducing";
import { FactoryPutResource } from "../../Control/State/room/core/factory/FactoryPutResource";
import { FactoryComplete } from "../../Control/State/room/core/factory/FactoryComplete";
import { SubMachineState } from "framework/FSM/SubMachineState";
import { DecisionIsProduceReady } from "../../Control/Decision/module/factory/DecisionIsProduceReady";
import { TargetState } from "framework/FSM/DecisionTree/DecisionTargetState";
import { DecisionIsProduceComplete } from "../../Control/Decision/module/factory/DecisionIsProduceComplete";
import { DecisionIsFactoryProduceSpaceEnough } from "../../Control/Decision/module/factory/DecisionIsFactoryProduceSpaceEnough";
import { DecisionTreeTransition } from "framework/FSM/Transition/DecisionTreeTransition";
import { HierarchicalStateMachine } from "framework/FSM/HierarchicalStateMachine";

 
export class AIProduceFactory
{
   
    // 升级小队
    static CreateFactory()
    {
        const state_get = new FactoryGetResource();

        const state_producing = new FactoryProducing();
        const state_put = new FactoryPutResource();
        const state_complete = new FactoryComplete();
        const SUB_Behavior = new SubMachineState([ state_get,state_producing,state_put,state_complete]);

        // 准备
       
        // 取资源
        const d_get = new DecisionIsProduceReady(
            new TargetState(state_producing)
        )


        // 生产
        const d_produce =
                new DecisionIsProduceComplete(
                    new TargetState(state_complete),
                    new DecisionIsFactoryProduceSpaceEnough(
                        new DecisionIsProduceReady(
                            undefined,
                            new TargetState(state_get),
                        ),
                        new TargetState(state_put),
                    )
                )


        //
        const d_put = new DecisionIsFactoryProduceSpaceEnough(
            new TargetState(state_producing),
        )

        //
        const d_complete = new DecisionIsProduceComplete(
            undefined,
            new TargetState(state_get)
        )

        state_get.addTransition(new DecisionTreeTransition(d_get));
        state_producing.addTransition(new DecisionTreeTransition(d_produce));
        state_put.addTransition(new DecisionTreeTransition(d_put));
        state_complete.addTransition(new DecisionTreeTransition(d_complete));

        return SUB_Behavior
    }
    
}